package xhttp

import "net/http"

const (
	HeaderAccept              = "Accept"
	HeaderAcceptEncoding      = "Accept-Encoding"
	HeaderAllow               = "Allow"
	HeaderAuthorization       = "Authorization"
	HeaderContentDisposition  = "Content-Disposition"
	HeaderContentEncoding     = "Content-Encoding"
	HeaderContentLength       = "Content-Length"
	HeaderContentType         = "Content-Type"
	HeaderCookie              = "Cookie"
	HeaderSetCookie           = "Set-Cookie"
	HeaderIfModifiedSince     = "If-Modified-Since"
	HeaderLastModified        = "Last-Modified"
	HeaderLocation            = "Location"
	HeaderUpgrade             = "Upgrade"
	HeaderVary                = "Vary"
	HeaderWWWAuthenticate     = "WWW-Authenticate"
	HeaderXForwardedFor       = "X-Forwarded-For"
	HeaderXForwardedProto     = "X-Forwarded-Proto"
	HeaderXForwardedProtocol  = "X-Forwarded-Protocol"
	HeaderXForwardedSsl       = "X-Forwarded-Ssl"
	HeaderXUrlScheme          = "X-Url-Scheme"
	HeaderXHTTPMethodOverride = "X-HTTP-Method-Override"
	HeaderXRealIP             = "X-Real-IP"
	HeaderXRequestID          = "X-Request-ID"
	HeaderXRequestedWith      = "X-Requested-With"
	HeaderServer              = "Server"
	HeaderOrigin              = "Origin"

	// Access control
	HeaderAccessControlRequestMethod    = "Access-Control-Request-Method"
	HeaderAccessControlRequestHeaders   = "Access-Control-Request-Headers"
	HeaderAccessControlAllowOrigin      = "Access-Control-Allow-Origin"
	HeaderAccessControlAllowMethods     = "Access-Control-Allow-Methods"
	HeaderAccessControlAllowHeaders     = "Access-Control-Allow-Headers"
	HeaderAccessControlAllowCredentials = "Access-Control-Allow-Credentials"
	HeaderAccessControlExposeHeaders    = "Access-Control-Expose-Headers"
	HeaderAccessControlMaxAge           = "Access-Control-Max-Age"

	// Security
	HeaderStrictTransportSecurity         = "Strict-Transport-Security"
	HeaderXContentTypeOptions             = "X-Content-Type-Options"
	HeaderXXSSProtection                  = "X-XSS-Protection"
	HeaderXFrameOptions                   = "X-Frame-Options"
	HeaderContentSecurityPolicy           = "Content-Security-Policy"
	HeaderContentSecurityPolicyReportOnly = "Content-Security-Policy-Report-Only"
	HeaderXCSRFToken                      = "X-CSRF-Token"
	HeaderReferrerPolicy                  = "Referrer-Policy"
)

// MIME types
const (
	MIMEApplicationJSON                  = "application/json"
	MIMEApplicationJSONCharsetUTF8       = MIMEApplicationJSON + "; " + charsetUTF8
	MIMEApplicationJavaScript            = "application/javascript"
	MIMEApplicationJavaScriptCharsetUTF8 = MIMEApplicationJavaScript + "; " + charsetUTF8
	MIMEApplicationXML                   = "application/xml"
	MIMEApplicationXMLCharsetUTF8        = MIMEApplicationXML + "; " + charsetUTF8
	MIMETextXML                          = "text/xml"
	MIMETextXMLCharsetUTF8               = MIMETextXML + "; " + charsetUTF8
	MIMEApplicationForm                  = "application/x-www-form-urlencoded"
	MIMEApplicationProtobuf              = "application/protobuf"
	MIMEApplicationMsgpack               = "application/msgpack"
	MIMETextHTML                         = "text/html"
	MIMETextHTMLCharsetUTF8              = MIMETextHTML + "; " + charsetUTF8
	MIMETextPlain                        = "text/plain"
	MIMETextPlainCharsetUTF8             = MIMETextPlain + "; " + charsetUTF8
	MIMEMultipartForm                    = "multipart/form-data"
	MIMEOctetStream                      = "application/octet-stream"
)

const (
	charsetUTF8 = "charset=UTF-8"
	// PROPFIND Method can be used on collection and property resources.
	PROPFIND = "PROPFIND"
	// REPORT Method can be used to get information about a resource, see rfc 3253
	REPORT = "REPORT"
)

// HTTP methods
// NOTE: Deprecated, please use the stdlib constants directly instead.
const (
	CONNECT = http.MethodConnect
	DELETE  = http.MethodDelete
	GET     = http.MethodGet
	HEAD    = http.MethodHead
	OPTIONS = http.MethodOptions
	PATCH   = http.MethodPatch
	POST    = http.MethodPost
	// PROPFIND = "PROPFIND"
	PUT   = http.MethodPut
	TRACE = http.MethodTrace
)

var BlobType map[string]string = map[string]string{
	"xls":    "application/vnd.ms-excel",
	"xlsx":   "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
	"csv":    "text/csv",
	"doc":    "application/msword",
	"docx":   "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
	"pdf":    "application/pdf",
	"ppt":    "application/vnd.ms-powerpoint",
	"pptx":   "application/vnd.openxmlformats-officedocument.presentationml.presentation",
	"png":    "image/png",
	"gif":    "image/gif",
	"jpeg":   "image/jpeg",
	"jpg":    "image/jpeg",
	"mp3":    "audio/mpeg",
	"aac":    "audio/aac",
	"html":   MIMETextHTML,
	"css":    "text/css",
	"js":     "text/javascript",
	"json":   MIMEApplicationJSON,
	"abw":    "application/x-abiword",
	"arc":    "application/x-freearc",
	"avi":    "video/x-msvideo",
	"azw":    "application/vnd.amazon.ebook",
	"bin":    "application/octet-stream",
	"bmp":    "image/bmp",
	"bz":     "application/x-bzip",
	"bz2":    "application/x-bzip2",
	"csh":    "application/x-csh",
	"eot":    "application/vnd.ms-fontobject",
	"epub":   "application/epub+zip",
	"htm":    MIMETextHTML,
	"ico":    "image/vnd.microsoft.icon",
	"ics":    "text/calendar",
	"jar":    "application/java-archive",
	"jsonld": "application/ld+json",
	"mid":    "audio/midi audio/x-midi",
	"midi":   "audio/midi audio/x-midi",
	"mjs":    "text/javascript",
	"mpeg":   "video/mpeg",
	"mpkg":   "application/vnd.apple.installer+xml",
	"odp":    "application/vnd.oasis.opendocument.presentation",
	"ods":    "application/vnd.oasis.opendocument.spreadsheet",
	"odt":    "application/vnd.oasis.opendocument.text",
	"oga":    "audio/ogg",
	"ogv":    "video/ogg",
	"ogx":    "application/ogg",
	"otf":    "font/otf",
	"rar":    "application/x-rar-compressed",
	"rtf":    "application/rtf",
	"sh":     "application/x-sh",
	"svg":    "image/svg+xml",
	"swf":    "application/x-shockwave-flash",
	"tar":    "application/x-tar",
	"tif":    "image/tiff",
	"tiff":   "image/tiff",
	"ttf":    "font/ttf",
	"txt":    MIMETextPlain,
	"vsd":    "application/vnd.visio",
	"wav":    "audio/wav",
	"weba":   "audio/webm",
	"webm":   "video/webm",
	"webp":   "image/webp",
	"woff":   "font/woff",
	"woff2":  "font/woff2",
	"xhtml":  "application/xhtml+xml",
	"xml":    MIMETextXML,
	"xul":    "application/vnd.mozilla.xul+xml",
	"zip":    "application/zip",
}
